import math


def calc_robot_steps() -> str:
    x, y = 0, 0
    print("请输入移动方向和步数【UP 1、DOWN 1、LEFT 1、RIGHT 1、STOP】")
    while True:
        s = input("#")
        if s == "STOP":
            break
        derection, movements = s.strip().split(" ")
        steps = int(movements)
        if derection == "UP":
            y += steps
        elif derection == "DOWN":
            y -= steps
        elif derection == "LEFT":
            x -= steps
        elif derection == "RIGHT":
            x += steps
    return "距离原点:{0}".format(int(round(math.sqrt(x ** 2 + y ** 2))))


if __name__ == '__main__':
    print(calc_robot_steps())
